package lia.util;

import java.util.HashMap;
import java.util.Map;

import org.apache.lucene.document.Field;
import org.apache.lucene.util.Version;

/**
 * Primary constants used in lia.
 * 
 * @author Wenlong Meng(wenlong.meng@gmail.com)
 * @version 1.0 at 2011/08/01
 * @version 1.1 at 2011/08/06 update by F.H Dragon for add CONFIG_FIELD_*S
 */
public final class Constants {

	/**
	 * lia index path
	 */
	public static final String LIA_INDEX_DIR = "/datas/lia/indexs/chapter%s";

	/**
	 * lia index-data path
	 */
	public static final String LIA_DATA_DIR = "/datas/lia/datas/chapter%s";
	
	/**
	 * lia index-config path
	 */
	public static final String LIA_CONFIG_PATH = "/datas/lia/configs/lia_indexConfigs.xml";
	
	/**
	 * lia index-config path
	 */
	public static final String LIA_CONFIG_INDEXINFO_PATH = "/datas/logs/lia/indexInfo.log";

	/**
	 * lucene version
	 */
	public static final Version LUCENE_VERSION = Version.LUCENE_33;
	
	/**
	 * field store type
	 */
	public static final Map<String, Field.Store> CONFIG_FIELD_STORES = new HashMap<String, Field.Store>();
	static{
		CONFIG_FIELD_STORES.put("NO", Field.Store.NO);
		CONFIG_FIELD_STORES.put("YES", Field.Store.YES);
	}
	
	/**
	 * field index type
	 */
	public static final Map<String, Field.Index> CONFIG_FIELD_INDEXS = new HashMap<String, Field.Index>();
	static{
		CONFIG_FIELD_INDEXS.put("NO", Field.Index.NO);
		CONFIG_FIELD_INDEXS.put("ANALYZED", Field.Index.ANALYZED);
		CONFIG_FIELD_INDEXS.put("ANALYZED_NO_NORMS", Field.Index.ANALYZED_NO_NORMS);
		CONFIG_FIELD_INDEXS.put("NOT_ANALYZED", Field.Index.NOT_ANALYZED);
		CONFIG_FIELD_INDEXS.put("NOT_ANALYZED_NO_NORMS", Field.Index.NOT_ANALYZED_NO_NORMS);
	}
	
	/**
	 * field TermVector type
	 */
	public static final Map<String, Field.TermVector> CONFIG_FIELD_TERMVECTORS = new HashMap<String, Field.TermVector>();
	static{
		CONFIG_FIELD_TERMVECTORS.put("NO", Field.TermVector.NO);
		CONFIG_FIELD_TERMVECTORS.put("WITH_OFFSETS", Field.TermVector.WITH_OFFSETS);
		CONFIG_FIELD_TERMVECTORS.put("WITH_POSITIONS", Field.TermVector.WITH_POSITIONS);
		CONFIG_FIELD_TERMVECTORS.put("WITH_POSITIONS_OFFSETS", Field.TermVector.WITH_POSITIONS_OFFSETS);
		CONFIG_FIELD_TERMVECTORS.put("YES", Field.TermVector.YES);
	}

}